using octalforty.Waffle.ObjectModel.Business.Objects;

using Spring.Data.NHibernate.Generic.Support;

using Spring.Transaction;
using Spring.Transaction.Interceptor;

namespace octalforty.Waffle.ComponentModel.Managers.Impl
{
    /// <summary>
    /// <see cref="HibernateDaoSupport"/>-based implementation of the <see cref="IUserManagerService"/>.
    /// </summary>
    public class HibernateUserManagerService : HibernateDaoSupport, IUserManagerService
    {
        /// <summary>
        /// Initializes a new instance of <see cref="HibernateUserManagerService"/> class.
        /// </summary>
        public HibernateUserManagerService()
        {
        }

        #region IUserManagerService Members
        /// <summary>
        /// Saves or updates a given <paramref name="user"/>.
        /// </summary>
        /// <param name="user"></param>
        [Transaction(TransactionPropagation.Required)]
        public void SaveUser(User user)
        {
            HibernateTemplate.SaveOrUpdate(user);
        }
        #endregion
    }
}